package com.egao.orderB.service.impl;

import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.JsonResult;
import com.egao.common.system.entity.User;
//import com.egao.orderB.mapper.ExStorageFeeMapper;
import com.egao.orderB.entity.ExStorageFee;
import com.egao.orderB.service.ExStorageFeeService;
import org.springframework.stereotype.Service;
import com.egao.orderB.biz.ExStorageFeeBiz;
import net.sf.json.JSONObject;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
//import javax.transaction.Transactional;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 订单运费服务实现类
 * @author : Doman
 * @date : 2022-03-14 16:04:20
 * @version ：1.0
 */
@Service
public class ExStorageFeeServiceImpl /*extends ServiceImpl<ExStorageFeeMapper, ExStorageFee> */implements ExStorageFeeService {

	@Autowired
	private ExStorageFeeBiz exStorageFeeBiz;

  @Override
  public JsonResult list(PageResult2<T> page, ExStorageFee exStorageFee, User loginUser)  throws Exception{
    return exStorageFeeBiz.list(page,exStorageFee,loginUser);
  }

  @Override
  public JsonResult list(ExStorageFee exStorageFee, User loginUser) {
    return JsonResult.ok().setData(exStorageFeeBiz.list(exStorageFee,loginUser));
  }

  @Override
  public JsonResult getById(ExStorageFee exStorageFee) {
    return JsonResult.ok().setData(exStorageFeeBiz.getById(exStorageFee));
  }

  @Transactional
  @Override
  public JsonResult save(ExStorageFee exStorageFee, User loginUser) {
    if (exStorageFeeBiz.save(exStorageFee, loginUser)) {
      return JsonResult.ok("添加成功");
    }
    return JsonResult.error("添加失败");
  }

  @Transactional
  @Override
  public JsonResult update(ExStorageFee exStorageFee, User loginUser) {
    if (exStorageFeeBiz.update(exStorageFee, loginUser)) {
      return JsonResult.ok("修改成功");
    }
    return JsonResult.error("修改失败");
  }

  @Transactional
  @Override
  public JsonResult remove(ExStorageFee exStorageFee, User loginUser) {
    if (exStorageFeeBiz.remove(exStorageFee, loginUser)) {
      return JsonResult.ok("删除成功");
    }
    return JsonResult.error("删除失败");
  }

}
